/*-
 * Copyright (c) 2010-2012 Shang-Rong Cai. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $ BASE: bscmpi.h    Rev. 1.1.1    2012-11-13T21:37+08:00 $
 */

#ifndef BSCMPI_H
#define BSCMPI_H

/*
 * Support MPI version elder than 2.2 by defining macro LEGACY_MPI
 */
#ifdef LEGACY_MPI

/* Signed Integer Types */
#ifndef MPI_INT8_T
#define MPI_INT8_T MPI_SIGNED_CHAR
#endif

#ifndef MPI_INT16_T
#define MPI_INT16_T MPI_SHORT
#endif

#ifndef MPI_INT32_T
#define MPI_INT32_T MPI_INT
#endif

#ifndef MPI_INT64_T
#define MPI_INT64_T MPI_LONG_LONG
#endif

/* Unsigned Integer Types */
#ifndef MPI_UINT8_T
#define MPI_UINT8_T MPI_UNSIGNED_CHAR
#endif

#ifndef MPI_UINT16_T
#define MPI_UINT16_T MPI_UNSIGNED_SHORT
#endif

#ifndef MPI_UINT32_T
#define MPI_UINT32_T MPI_UNSIGNED
#endif

#ifndef MPI_UINT64_T
#define MPI_UINT64_T MPI_UNSIGNED_LONG_LONG
#endif

#endif

/* Send/Recv of Data Types sidx_t and uidx_t */
#ifdef INDEX_64
#define BASE_MPI_SIDX_T MPI_INT64_T
#define BASE_MPI_UIDX_T MPI_UINT64_T
#else
#define BASE_MPI_SIDX_T MPI_INT32_T
#define BASE_MPI_UIDX_T MPI_UINT32_T
#endif

/* Send/Recv of Data Types cell_t and face_t */
#define BASE_MPI_CELL_T MPI_INT8_T
#define BASE_MPI_FACE_T MPI_INT8_T

/* Send/Recv of Size Type size_t */
#define BASE_MPI_SIZE_T MPI_UNSIGNED_LONG

#endif
